package work.lpssfxy.www.campuslifeassistantserver.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import work.lpssfxy.www.campuslifeassistantserver.bean.UserBean;
import work.lpssfxy.www.campuslifeassistantserver.service.UserService;

/**
 * created by on 2021/8/10
 * 描述：登录
 *
 * @author ZSAndroid
 * @create 2021-08-10-4:07
 */

public class LoginController {
    //将Service注入Web层
    @Autowired
    UserService userService;

    @RequestMapping("/login")
    public String show(){
        return "login";
    }

    @RequestMapping(value="/loginIn",method = RequestMethod.POST)
    public String login(String name,String password){
        UserBean userBean=userService.loginIn(name,password);
        if (userBean!=null){
            return "success";
        }else{
            return "error";
        }
    }

}
